﻿<?php 
	include_once '../action/checkLogin.php';
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>新闻发布</title>
    <link type="text/css" rel="stylesheet" href="/public/css/bootstrap.min.css" />
    <link type="text/css" rel="stylesheet" href="/public/otherPlus/datetimepicker/datetimepicker.min.css" />

    <script type="text/javascript" src="/public/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="/public/js/bootstrap.min.js"></script>

    <script type="text/javascript" src="/public/otherPlus/datetimepicker/datetimepicker.min.js"></script>
    <script type="text/javascript" src="/public/otherPlus/datetimepicker/datetimepicker.zh-CN.js"></script>

    <script type="text/javascript" src="/public/js/tools.js"></script>
    <script type="text/javascript" src="/public/otherPlus/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="/public/otherPlus/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" src="/public/otherPlus/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        $(function () {
            //加载文本编辑器
            var editor = new UE.ui.Editor();
            editor.render('content');
        })
    </script>
    <?php 
    	include_once '../../public/inc/DB.php';
    	$db = new DB('jusmor_news_cate');
    ?>
</head>
<body>
    <div class="container col-lg-12 ">
        <h3 style="border-bottom: 3px solid #336699; padding-bottom: 2px;"><strong>发布文章</strong></h3>
        <form class="form-horizontal" role="form" method="post" name="form1" id="form1" action="../action/news.php">
            <input type="hidden" name="action" value="save" />
            <div class="row">
                <div class="col-md-10">
                    <div class="form-group">
                        <label for="inputTitle" class="col-sm-1 control-label">标题</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" id="inputTitle" placeholder="文章标题" name="news_title" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputkeywords" class="col-sm-1 control-label">关键字</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="inputkeywords" placeholder="关键字" name="keywords" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputdescription" class="col-sm-1 control-label">描述</label>
                        <div class="col-sm-7">
                            <textarea class="form-control" rows="3" name="description" placeholder="描述"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="content">文章内容</label>
                        <div class="col-sm-12">
                            <textarea id="content" name="news_content" style="height: 400px; width: 100%;"></textarea>
                        </div>
                    </div>
                </div>
                <div class="col-md-2">
                    <div class="form-group">
                        <label class="sr-only" for="button">发布文章</label>
                        <div class="col-sm-12">
                            <button type="button" id="button" class="btn btn-primary btn-block submit">发布文章</button>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="news_cate_id">文章分类</label>
                        <div class="col-sm-12">
                        	<?php 
                        		$condition = array('status'=>1);
                        		$news_cate_list = $db->fetchAll($condition);
                        	?>
                            <select class="form-control" name="news_cate_id" id="news_cate_id">
                            	<option value="">请选择文章分类</option>
                            <?php 
                            	if(! empty($news_cate_list)) {
                            		foreach ($news_cate_list as $key=>$val) {
                            ?>
                                <option value="<?php echo $val['news_cate_id']; ?>"><?php echo $val['news_cate_name']; ?></option>
                            <?php 
                            		}
                            	}
                            ?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="datetimepicker">发布时间</label>
                        <div class="col-sm-12 input-append date form_datetime">
                            <input type="text" class="form-control" value="" id="datetimepicker" readonly="true" name="s_date"> 
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        $(function () {
            $("#datetimepicker").val(CurentTime());

            $('#datetimepicker').datetimepicker({
                format: 'yyyy-mm-dd hh:ii:ss'
            });

            $(".submit").click(function () {
                $("#form1").submit();
            })
        })

    </script>
</body>
</html>
